/*
*Appendix Figure 5
Moderation of Association Between Firm-Level Exposure to PSL Mandates and Workers' Reports of Access to PSL in Non-PSL Mandate Places —Firm Headquarters Location, Excluding IKEA
*/

cd "$exhibits_path"

use "$data_path/main_analysis_file.dta", clear

set scheme plotplain

* define controls
	global demog i.gender i.race2_harm c.age_text_clean i.kids i.eslhome i.enrolled i.cohabstatus
	global work i.manager i.longwork_yrs i.union c.hourwage_clean c.usualhours_clean 
	global statechars c.unionmem_pc c.unemp_rate  c.minwage_state  	c.race_black c.race_amind c.race_asian c.race_pacisl c.race_other c.race_multi c.hispan c.age_u5 c.age_5to9 c.age_10to14 c.age_75to84 c.age_85plus c.female_pc c.educ_pc_hsgrad c.educ_pc_somecoll c.educ_pc_assoc c.educ_pc_bach c.educ_pc_grad

label def HQ_lab 1 "HQ Covered by PSL" 0 "HQ Not Covered by PSL"
label val HQ_PSL_Covered HQ_lab

* excluding IKEA
drop if q1_employer==120

mi est: reg benefits_paidsick c.pct_emps_psl_place##i.HQ_PSL_Covered $demog $work $statechars2 i.statelist i.year##i.month if  psl_law_places_hybd == 0, vce(cluster statelist)

mimrgns, at(pct_emps_psl_place=(0(5)50)) over(HQ_PSL_Covered) cmdmargins vsquish esampvaryok
	marginsplot, ///
	title("", size(small)) ///
	xtitle("% of Firm's Workers", size(small)) ///
	legend(row(1) pos(6)) ///
	plot1opt(lcolor(gs8) mcolor(gs8)) plot2opt(lcolor(green) mcolor(green)) ///
	 ci1opt(color(gs8)) ci2opt(color(green)) ///
	ytitle("% of Workers in Non-PSL Mandate States or Counties" "Reporting Access to Paid Sick", size(small)) ///
	ylabel(0 "0%" .1 "10%" .2 "20%" .3 "30%" .4 "40%" .5 "50%",labsize(small)) ///
	xlabel(0 "0%" 5 "5%" 10 "10%" 15 "15%" 20 "20%" 25 "25%" 30 "30%" 35 "35%" 40 "40%" 45 "45%" 50 "50%",labsize(small))  

	graph export "$exhibits_path\Appendix Figure 5.pdf", replace